//接口  不是后台api
interface BoyFriend extends UserInfo{
    //可选属性
    car?:string
    // 只读属性
    readonly id:number
    //限制方法
    cook:()=> void
}

//声明 员工的接口
interface Staff extends UserInfo{
    work:()=>void
}

//声明 一个 人员相关的接口
interface UserInfo{
    name:string
    age:number
}


//声明一个人的对象
// let person:BoyFriend = {
//        name:"张三",
//        age:18,
//        car:"奔驰GLC",
//        id:1,
//        cook:()=>{
//             console.log("我会做饭");
//        }
       
// }


//  类和接口   implements【实现】
//接口的多实现
class Person implements BoyFriend,Staff{

    name:string;
    age:number;
    id:number;
    car:string;

    constructor(name:string,id:number,car:string,age:number){
        this.name = name;
        this.age = age;
        this.car = car;
        this.id = id;
    }

    cook = () => {
        console.log("我会做饭");
    }

    work = () => {
        console.log("我会敲代码");
    }
}


// let p:BoyFriend = new Person("张三",1,"捷安特",18);
// let p1:Person = new Person("李四",2,"美利达",28);

// console.log(p,p1);

let p2:Person = new Person("张三",1,"捷安特",18);
console.log(p2);







export{}